<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    
    <title>用户修改</title>
<link rel="stylesheet" href="<%=basePath%>ui/css/edit.css" />
	<script type="text/javascript">
		function checkForm(){
			if(document.getElementById("userName").value == ""){
				alert("请输入用户名！");
				document.getElementById("userName").focus();
				return false;
			}
			
			if(document.getElementById("password").value == ""){
				alert("请输入密码！");
				document.getElementById("password").focus();
				return false;
			}
			
			if(document.getElementById("pwd").value == ""){
				alert("请输入确认密码！");
				document.getElementById("pwd").focus();
				return false;
			}
			
			if(document.getElementById("password").value != document.getElementById("pwd").value){
				alert("确认密码和密码不一致！");
				document.getElementById("pwd").focus();
				return false;
			}
			
			if(document.getElementById("roleId").value == ""){
				alert("请选择角色！");
				document.getElementById("roleId").focus();
				return false;
			}
			
			return true;
		}
		
		
	</script>
  </head>
  
  <body>
  		<form action="${basePath }user/editUser/${porCode}.html" method="post" onsubmit="return checkForm()">
	  		<table cellspacing="0" cellpadding="0" border="0"  class="addclass">
	  		 <tr>
	  		    <td colspan="2><div class="nav"><%@ include file="/common/nav.jsp"%></div></tr>
	  		  </tr>
							<tr>
								<td width="20%" class="trLeft">用户名：</td>
								<td><input id="userName" name="userName" type="text" value="${user.userName }"
									maxlength="25" /></td>
							</tr>
							<tr>
								<td width="20%" class="trLeft">密码：</td>
								<td><input id="password" name="password" type="password" value="${user.password }"
									maxlength="25" /></td>
							</tr>
							<tr>
								<td width="20%" class="trLeft">确认密码：</td>
								<td><input id="pwd" type="password" maxlength="25"  value="${user.password }"/></td>
							</tr>
							<tr>
								<td width="20%" class="trLeft">角色：</td>
								<td><select id="roleId" name="roleId">

										<option value="">--请选择--</option>
										<c:forEach items="${roles}" var="role">
											<option value="${role.id }" <c:if test="${role.id == user.roleId }">selected="selected"</c:if>>${role.roleName }</option>
										</c:forEach>
								</select></td>
							</tr>
							<tr>
								<input type="hidden" value="${user.id }" name="id"/>
								<td colspan="2" align="center"><input type="submit"
									value=" 提  交 "  class="button"/></td>
							</tr>
						</table>
  		</form>
  </body>
</html>
